<template>
  <div>
    <el-form :inline="true" :model="formInline" class="demo-form-inline">
      <el-form-item label="学号">
        <el-input v-model="formInline.user"></el-input>
      </el-form-item>
      <el-form-item label="表">
        <el-select v-model="formInline.region">
          <el-option label="智育表" value="Zy"></el-option>
          <el-option label="德育表" value="Dy"></el-option>
          <el-option label="体育表" value="Ty"></el-option>
          <el-option label="劳育表" value="Ly"></el-option>
          <el-option label="美育表" value="My"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="onSubmit">查询</el-button>
      </el-form-item>
    </el-form>
    <el-table
      :data="ZyData.slice((paginations.currentPage-1)*paginations.PageSize,paginations.currentPage*paginations.PageSize)"
      border highlight-current-row v-loading="listLoading" @selection-change="selsChange"
      style="width: 100%;" :fit=false :stripe=true>
      <el-table-column prop="index" label="序号" width="50" type="index">
      </el-table-column>
      <el-table-column prop="xxName" label="细项名称" width="120">
      </el-table-column>
      <el-table-column prop="contentSm" label="内容说明" width="280">
      </el-table-column>
      <el-table-column prop="eviMat" label="证明材料" width="180">
      </el-table-column>
      <el-table-column prop="sugScore" label="建议评分" width="80">
      </el-table-column>
      <el-table-column prop="zySelfScore" label="自评分" width="80">
      </el-table-column>
      <el-table-column prop="zyBwScore" label="班委评分" width="80">
      </el-table-column>
      <el-table-column prop="zyNewTime" label="更新时间" width="90">
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
export default {
  name: 'Search',
  data () {
    return {
      formInline: {
        user: '',
        region: ''
      },
      listLoading: '',
      ZyData: '',
      paginations: {
        // 默认显示第几页
        currentPage: 1,
        // 个数选择器（可修改）
        pageSizes: [1, 2, 3, 4],
        // 默认每页显示的条数（可修改）
        PageSize: 4,
      },
    }
  },
  methods: {
    onSubmit () {
      this.$axios.get(`http://localhost:/self/select${this.formInline.region}Data/${this.formInline.user}` ).then(res => {
        if (res.status === 200) {
          // console.log(res.data)
          this.ZyData = res.data
        }
        else{
          return '请求失败'
        }
      })
    },
    selsChange: function (val) {  //点击选中
      console.log(val);
      this.selected = val;
    },
  }
}
</script>
<style>

</style>

